package com.qingcheng.service.impl;

import com.qingcheng.dao.OrderInfoSumMapper;
import com.qingcheng.pojo.order.OrderInfoSum;
import com.qingcheng.service.OrderInfoSumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class OrderInfoSumServiceImpl implements OrderInfoSumService {

    @Autowired(required = false)
    private OrderInfoSumMapper orderInfoSumMapper;

    @Override
    public OrderInfoSum findOrderSum(String date1, String date2, String date3, String date4) {
        OrderInfoSum orderinfosum = orderInfoSumMapper.findOrder(date1, date2, date3, date4);
        if (orderinfosum.getYesterday_pay_sum()==null)
            orderinfosum.setYesterday_pay_sum(0);
        if (orderinfosum.getToday_pay_sum()==null)
            orderinfosum.setToday_pay_sum(0);
        if (orderinfosum.getWeek_pay_sum()==null)
            orderinfosum.setWeek_pay_sum(0);
        return orderinfosum;
    }
}
